<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8"/>
    <title>登录</title>
    <meta name="keywords" content="">
    <meta name="description" content="">
    <meta name="renderer" content="webkit">
    <meta http-equiv="Cache-Control" content="no-siteapp"/>
    <meta name="mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="format-detection" content="telephone=no,email=no,address=no"/>
    <meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no">
    <link rel="stylesheet" href="../css/common.css"/>
    <link rel="stylesheet" href="../css/main.css"/>
</head>
<body class="login">
<article class="pt120 plr30">
    <section class="bw plr40 shadow">
        <div class="tac ptb60">
            <img src="../img/logo.png" style="width: 3.5rem;">
        </div>
        <div>
            <label class="plr20 bdb ptb30 flex_a">
                <img src="../img/ico1.png" style="width: .3rem;">
                <input type="number" class="ml20 flex1" id="phone" placeholder="请输入手机号码" oninput="this.value = this.value.replace(/\D/g,'')">
            </label>
            <label class="plr20 bdb ptb30 flex_a">
                <img src="../img/ico2.png" style="width: .3rem;">
                <input type="password" class="ml20 flex1" placeholder="请输入您的密码" id="password">
            </label>
        </div>
        <div class="tae">
            <a href="./find_password.html" class="lh80 color1 tdu">忘记密码?</a>
        </div>
        <div class="ptb40 flex_aj">
            <button class="bgc1 colw lh80 border-r6 plr110 btn_tap">登录</button>
        </div>
    </section>
</article>
</body>
</html>
<script src="../js/jquery-1.8.3.min.js"></script>
<script src="../js/dlc.js"></script>
<script>
    if(get_save('userName')){
        $('#phone').val(get_save('userName'));
        $('#password').val(get_save('userKey'));
    }
    $('.btn_tap').click(function(){
        var phone = $('#phone').val();
        var password = $('#password').val();
        if(isNull(phone)){
            dlctipbox.show('请输入手机号码');
        }else if(!checkMobileAndTel(phone)){
            dlctipbox.show('请输入正确的手机号');
        }else if(isNull(password)){
            dlctipbox.show('请输入您的密码');
        }else{
            dlc_request('/api/agent/login',{'phone':phone,'password':password,'openId':user_openid()},function(res){
                console.log(res);
                if(res.code==1){
                    save('userName',phone);
                    save('userKey',password);
                    save('userId',res.data.agent.id);
                    if(res.data.agent.type==0){
                        location.href = './ad_index.html';
                    }
                }else{
                    dlctipbox.show(res.msg);
                }
            });
        }
    });
</script>






















